<template>
    <div>
        <!--顶栏-->
        <div class="top-bar">
            <van-icon name="arrow-left" color="white" size="30" @click="goBack"/>
            <h3>{{historyToday.year}}</h3>
        </div>
        <!--内容-->
        <div class="history-content">
            <h3 class="title">{{historyToday.title}}</h3>
            <div class="content" v-html="historyToday.content"></div>
        </div>
    </div>
</template>

<script>
    import {historyToday} from '../api/CMS-api'
    export default {
        created(){
            const date = new Date();
            const month = date.getMonth()+1;
            const day = date.getDate();
            historyToday('eed9a7a326471393', month, day).then(res => {
                this.historyToday = res.result[this.$route.params.index]
            });
        },
        data(){
            return{
                historyToday:{}
            }
        },
        methods:{
            goBack(){
                this.$router.back()
            }
        }
    }
</script>

<style lang="less" scoped>
    .top-bar {
        width: 100%;
        height: 50px;
        background-color: #f34f4f;
        display: flex;
        justify-content: space-between;
        align-items:center;
        h3 {
            color: white;
            font-size: 23px;
            margin-right: 10px;
        }
    }
    .history-content {
        width: 100%;
        height: auto;
        h3 {
            text-align: center;
        }
        .content {
            margin-top: 30px;
            padding: 0 10px;
        }
    }
</style>